home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / Installation Folder / Install < prev    next >
Encoding:
Text File  |  1990-11-13  |  9.3 KB  |  385 lines  |  [TEXT/MPWi]

  1. #    C D   I N S T A L L A T I O N   S C R I P T
  2. #
  3. #    Copyright Apple Computer, Inc. 1987, 1988, 1989, 1990
  4. #    All rights reserved.
  5. #
  6. #    This script is used to install MPW, MacApp, C++, SADE, MacsBug,
  7. #    ResEdit and MPW 411 from the E.T.O. #2 distribution compact disk 
  8. #    onto a destination hard disk. This can also update from previous 
  9. #    versions of these products to the latest releases and revert from
  10. #    later versions to a previous release.
  11. #
  12. #    This script accepts the following options (set by the Commando interface):
  13. #
  14. #    -to            sets the "to" directory
  15. #    -from        sets the "from" directory(s)
  16. #    -custom        sets the custom files list
  17. #
  18. #    -install    flag to install a new complete version of MPW
  19. #    -update        flag to update an existing version of MPW (default behaviour)
  20. #    -revert        flag to revert to a previous version of MPW
  21. #
  22. #    -progress    flag to show progress
  23. #
  24. #    -SADE1.0    flag to install SADE environment (version 1.0)
  25. #    -SADE1.1    flag to install SADE environment (version 1.1)
  26. #    -SADE1.2    flag to install SADE environment (version 1.2b3)
  27. #    -SADE1.3    flag to install SADE environment (version 1.3a1)
  28. #
  29. #    -MB6.1        flag to install Macsbug (version 6.1 - in System Folder)
  30. #    -MB6.2        flag to install Macsbug (version 6.2b3 - in System Folder)
  31. #
  32. #    -MPW3.0        flag to install MPW (version 3.0)
  33. #    -MPW3.1        flag to install MPW (version 3.1)
  34. #    -MPW3.2        flag to install MPW (version 3.2b3)
  35. #    -MPWEXP        flag to install MPW (version 3.2 EXP)
  36. #
  37. #    -MacApp        flag to install MacApp (version 2.0.1)
  38. #    -C++        flag to install C++ (version 3.1)
  39. #
  40. #    -411Tools    flag to install 411 in MPW folder (Tools only)
  41. #    -411All        flag to install 411 in MPW folder (Complete environment)
  42. #
  43.  
  44. ##################
  45. ###    DEBUG CODE ###
  46. ##################
  47.  
  48. Set    DebugFlag    0        # Set to 1 for debugging, set to 0 for normal operation
  49.  
  50. ##################
  51.             
  52. Set quit 0                # Clear our user-defined quit flag.  If it
  53.                         # is ever Set non-zero, the user hit cancel
  54.                         # somewhere and the script quits immediately.
  55. Set Exit 0
  56.  
  57. ###                        Set some defaults
  58.             
  59. Set CDVolume    "E.T.O. #2:"    ### the volume name of the distribution CD
  60. Export CDVolume
  61.             
  62. #    {DestVolume} - the volume name of the destination hard drive
  63.             
  64. ###                        Get the current volume name
  65.  
  66.  
  67. Set DestVolume `which "{0}"`                    # get pathname of this script
  68. Set DestVolume "`files -q -f "{DestVolume}"`"    # convert to full pathname
  69. If "{DestVolume}"=~/(≈:)®1≈/                    # strip the filename
  70.     Set DestVolume "{®1}"
  71. End
  72. Loop
  73.     If "{DestVolume}"=~/(≈:)®1≈:/                # strip all sub-directories
  74.         Set DestVolume "{®1}"
  75.     Else
  76.         Break
  77.     End
  78. End
  79.  
  80. export    DestVolume
  81.  
  82. ###    Export some variables used by the Installer
  83.  
  84. set    ToDir        "{DestVolume}MPW Folder:"    # Destination ("to") directory
  85. set    FromDirs    ""                            # Source ("from") directory list
  86.  
  87. set InstallFlag    1        # Controls Update/Install/Revert (Update is the default)
  88. set UpdateFlag    "Update"
  89.  
  90. set    RevertFlag    ""        # Controls revert function
  91. set    ProgressOption    ""    # Controls progress display
  92.  
  93. set    MacAppFlag        0    # set for MacApp Installation (to install 411 files)
  94. export    MacAppFlag
  95.  
  96. set    SADEOption        0    # Controls SADE Installation
  97. export SADEOption
  98.  
  99. set MacsbugOption    0    # Controls Macsbug Installation
  100. export MacsbugOption
  101.  
  102. set    411Option        0    # Controls 411 Installation
  103. export 411Option
  104.  
  105. set    ResEditOption    0    # Controls ResEdit Installation
  106. export ResEditOption
  107.  
  108. ###        Source Directories
  109.  
  110. set MPWSource    "{CDVolume}Tools - Objects:Macintosh Programmer’s Workshop:"
  111. export MPWSource
  112.  
  113. set MacAppSource    "{CDVolume}Tools - Objects:MacApp:MacApp CD Release:"
  114. export MacAppSource
  115.  
  116. set CPlusSource    "{CDVolume}Tools - Objects:"
  117. export CPlusSource
  118.  
  119. ###     Let's get started...
  120.  
  121. If "{#}" == "0"        ### Command Line is Empty
  122.     Exit 1
  123. End
  124.  
  125. ###     See if the source volume exists...
  126.  
  127. If Not "`Exists -d "{CDVolume}"`"
  128.         Alert "Volume {CDVolume} is not online!"
  129.         Exit 1
  130. End
  131.  
  132. ###        Collect the script parameters.
  133. Loop
  134.     Break if {#} == 0
  135.     If "{1}" =~ /-from/
  136.         Set FromDirs "{FromDirs}'{2}' "
  137.         shift 2
  138.         continue
  139.     Else If "{1}" =~ /-to/
  140.         Set toDir    "'{2}'"
  141.         shift 2
  142.         continue
  143.     Else If "{1}" =~ /-custom/
  144.         Set FromDirs "{FromDirs}'{2}' "
  145.         shift 2
  146.         continue
  147.     Else If "{1}" =~ /-update/
  148.         set InstallFlag    1
  149.         set    UpdateFlag    "Update"
  150.         set    RevertFlag    ""
  151.         shift 1
  152.         continue
  153.     Else If "{1}" =~ /-install/
  154.         set InstallFlag    2
  155.         set    UpdateFlag    "Install"
  156.         set    RevertFlag    ""
  157.         shift 1
  158.         continue
  159.     Else If "{1}" =~ /-revert/
  160.         set InstallFlag    3
  161.         set    UpdateFlag    "Revert"
  162.         set    RevertFlag    "-revert"
  163.         shift 1 
  164.         continue
  165.     Else If "{1}" =~ /-MPW3.0/
  166.         Set FromDirs "{FromDirs}'{MPWSource}MPW 3.0:MPW:' "
  167.         If Not "`Exists -d {ToDir}`"
  168.             NewFolder "{ToDir}"
  169.         End
  170.         shift 1
  171.         continue
  172.     Else If "{1}" =~ /-MPW3.1/
  173.         Set FromDirs "{FromDirs}'{MPWSource}MPW 3.1:MPW:' "
  174.         If Not "`Exists -d {ToDir}`"
  175.             NewFolder "{ToDir}"
  176.         End
  177.         shift 1
  178.         continue
  179.     Else If "{1}" =~ /-MPW3.2/
  180.         Set FromDirs "{FromDirs}'{MPWSource}MPW QR2:MPW:' "
  181.         If Not "`Exists -d {ToDir}`"
  182.             NewFolder "{ToDir}"
  183.         End
  184.         shift 1
  185.         continue
  186.     Else If "{1}" =~ /-MPWEXP/
  187.         Set FromDirs "{FromDirs}'{MPWSource}MPW QR2:MPW:' "
  188.         Set FromDirs "{FromDirs}'{MPWSource}MPW PQR2:MPW:' "
  189.         If Not "`Exists -d {ToDir}`"
  190.             NewFolder "{ToDir}"
  191.         End
  192.         shift 1
  193.         continue
  194.     Else If "{1}" =~ /-MacApp/
  195.         If "`Exists -d "{MacAppSource}MacApp 2.0.1 (Hard Disk Ready):"`"
  196.             Set FromDirs "{FromDirs}'{MacAppSource}MacApp 2.0.1 (Hard Disk Ready):' "
  197.             Set MacAppFlag    1
  198.         End
  199.         shift 1
  200.         continue
  201.     Else If "{1}" =~ /-CPlus/
  202.         If "`Exists -d "{CPlusSource}MPW C++ 3.1:"`"
  203.             Set FromDirs "{FromDirs}'{CPlusSource}MPW C∂+∂+ 3.1:' "
  204.         End
  205.         shift 1
  206.         continue
  207.     Else If "{1}" =~ /-SADE1.0/
  208.         set    SADEOption    1
  209.         shift 1
  210.         continue
  211.     Else If "{1}" =~ /-SADE1.1/
  212.         set    SADEOption    2
  213.         shift 1
  214.         continue
  215.     Else If "{1}" =~ /-SADE1.2/
  216.         set    SADEOption    3
  217.         shift 1
  218.         continue
  219.     Else If "{1}" =~ /-SADE1.3/
  220.         set    SADEOption    4
  221.         shift 1
  222.         continue
  223.     Else If "{1}" =~ /-MB6.1/
  224.         set    MacsbugOption    1
  225.         shift 1
  226.         continue
  227.     Else If "{1}" =~ /-MB6.2/
  228.         set    MacsbugOption    2
  229.         shift 1
  230.         continue
  231.     Else If "{1}" =~ /-411Tools/
  232.         set    411Option    1
  233.         shift 1
  234.         continue
  235.     Else If "{1}" =~ /-411All/
  236.         set    411Option    2
  237.         shift 1
  238.         continue
  239.     Else If "{1}" =~ /-ResEdit1.3/
  240.         set    ResEditOption    1
  241.         shift 1
  242.         continue
  243.     Else If "{1}" =~ /-ResEdit2.0/
  244.         set    ResEditOption    2
  245.         shift 1
  246.         continue
  247.     Else If "{1}" =~ /-ResEdit2.1/
  248.         set    ResEditOption    3
  249.         shift 1
  250.         continue
  251.     Else If "{1}" =~ /-progress/
  252.         set    ProgressOption    "-p"
  253.         shift 1
  254.         continue
  255.     Else If "{1}" =~ /-≈/
  256.         Echo "### {0} - ∂"{1}∂" is not an option." > Dev:StdErr
  257.         Echo "# Usage - {0} -to dirname [ -from DirName | -custom filename ]" > Dev:StdErr
  258.         Echo "#         [ -install | -update | -revert ] [ -progress ]" > Dev:StdErr
  259.         Echo "#         [ -SADE ] [ -Macsbug ]" > Dev:StdErr
  260.         Exit 1
  261.     End
  262. End
  263.  
  264. If "{ToDir}" == ""
  265.     Echo "### {0} - Must Select Destination Directory"
  266.     Exit 1
  267. Else If "{FromDirs}" == "" && "{SADEOption}" == "0" && 
  268.     "{MacsBugOption}" == "0" && "{411Option}" == "0" && "{ResEditOption}" == "0"
  269.     Echo "### {0} - Must Select Source Directory"
  270.     Exit 1
  271. End
  272.  
  273. If Not "`Exists -d "{CDVolume}"`"
  274.         Alert "Volume {CDVolume} is not online!"
  275.         Exit 1
  276. End
  277.  
  278. If {DebugFlag} == 1
  279.     echo    "FromDirs:      {FromDirs}"        > Dev:StdOut
  280.     echo    "ToDir:         {ToDir}"        > Dev:StdOut
  281.     echo    "CustomFiles:   {CustomFiles}"    > Dev:StdOut
  282.     echo    "UpdateFlag:    {UpdateFlag}"    > Dev:StdOut
  283.     echo    "InstallFlag:   {InstallFlag}"    > Dev:StdOut
  284.     echo    "RevertFlag:    {RevertFlag}"    > Dev:StdOut
  285.     echo    "RevertOption:  {RevertOption}"    > Dev:StdOut
  286.     echo    "ProgressOption:{ProgressOption}"    > Dev:StdOut
  287.     Exit 1
  288. End
  289.  
  290.  
  291.     
  292.  
  293. # The backup tool will generate shell commands to copy the files off 
  294. # of the distribution compact disk into the final destination folder.
  295.  
  296. If "{FromDirs}" != ""
  297.  
  298.     For dir in {FromDirs}
  299.         "{ShellDirectory}"Backup -from "{dir}" -to "{ToDir}" -r -a -c {RevertFlag} {ProgressOption} > copyStuff
  300.         
  301.     # The DoIt script will execute the copy commands in the temporary 
  302.     # copyStuff file.  It will highlight each command as it is executed.
  303.         
  304.         "{ShellDirectory}"DoIt copyStuff ≥ errorFile
  305.     End
  306. End
  307.  
  308. ###    Now handle the special cases like SADE, Macsbug, 411 and ResEdit
  309.  
  310.  
  311. ###        One More Time...
  312.  
  313. If Not "`Exists -d "{CDVolume}"`"
  314.     Alert "Volume {CDVolume} is not online!"
  315.     Exit 1
  316. End
  317.  
  318. ###    Special for MacApp - move the UserStartup file up one level and rename the folder
  319.  
  320. If "{MacAppFlag}" != "0"
  321.     If "`Exists -f "{ToDir}:MacApp:UserStartup•MacApp"`"
  322.         Duplicate -y "{ToDir}:MacApp:UserStartup•MacApp" "{ToDir}:"
  323.     End
  324. End
  325.  
  326. ### Install SADE 1.0, 1.1, 1.2b3 or 1.3a2
  327.  
  328. If "{SADEOption}" != "0"
  329.     If "{ProgressOption}" =~ /-p/ 
  330.         Echo "Now Copying SADE..."
  331.     End
  332.     "SADE Install" ≥ errorFile
  333. End
  334.  
  335. ### Install Macsbug v. 6.1 or 6.2b3
  336.  
  337. If "{MacsbugOption}" != "0"
  338.     If "{ProgressOption}" =~ /-p/ 
  339.         Echo "Now Copying MacsBug..."
  340.     End
  341.     "MacsBug Install" ≥ errorFile
  342. End
  343.  
  344. ###    Install ResEdit v. 1.3, 2.0b2 or 2.1b5
  345.  
  346. If "{ResEditOption}" != "0"
  347.     If "{ProgressOption}" =~ /-p/ 
  348.         Echo "Now Copying ResEdit..."
  349.     End
  350.     "ResEdit Install" ≥ errorFile
  351. End
  352.  
  353. ### Install 411
  354.  
  355. If    "{411Option}" != "0"
  356.     If "{ProgressOption}" =~ /-p/ 
  357.         Echo "Now Copying 411..."
  358.     End
  359.     "411 Install" ≥ errorFile
  360. End
  361.  
  362.  
  363. # If we got some error while copying the file from the distribution 
  364. # compact disk to the destination disk, display the error message and quit.
  365.  
  366. If "`Exists -f "errorFile"`"
  367.     Open -t errorFile
  368.     Find • errorFile
  369.     Find /'#'/ errorFile     ### There is an error
  370.     Set FindStatus {Status}
  371.     Close errorFile
  372. Else
  373.     Set FindStatus 1
  374. End
  375.  
  376. If {FindStatus} == 0
  377.     Alert "`catenate errorFile`"
  378.     Close -n copyStuff ≥ dev:null
  379.     Quit
  380. Else
  381.     Delete copyStuff ≥ dev:null
  382. End
  383.  
  384. Exit 0
  385.